package com.atguigu.gulimall.cart.config;

import com.atguigu.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @title: GulimallWebConfig
 * @Author syh
 * @Date: 2022/7/10 14:39
 * @Version 1.0
 */

@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    /**
     * 设置拦截器,将对应拦截器注册进服务中,并配置要拦截哪些请求
     *
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CartInterceptor())
                .addPathPatterns("/**");
    }
}
